package com.cloud.feign.service;

import com.cloud.feign.service.impl.FallbackService;
import com.yingxue.lesson.entity.SysUser;
import com.yingxue.lesson.utils.DataResult;
import com.yingxue.lesson.vo.req.LoginReqVO;
import com.yingxue.lesson.vo.req.UserPageReqVO;
import com.yingxue.lesson.vo.resp.HomeRespVO;
import com.yingxue.lesson.vo.resp.LoginRespVO;
import com.yingxue.lesson.vo.resp.PageVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

/**
 * @author lai
 * @version 1.0
 * @date 2021/5/29 23:09
 * @description
 */
@Component
@FeignClient(value = "cloud-user" ,fallback = FallbackService.class)
public interface UserFeignService {

    @PostMapping("/api/users")
    public DataResult<PageVO<SysUser>>  pageInfo(@RequestBody UserPageReqVO vo);

    @PostMapping("/api/user/login")
    public DataResult<LoginRespVO> login(@RequestBody @Valid LoginReqVO vo);

    @GetMapping("/api/home")
    public DataResult<HomeRespVO> getHome(HttpServletRequest request);
}
